let app = getApp()
Component({
    properties: {
      noClass: {
        type: Boolean,
        default: !1
    },
    hasTabbar: {
        type: Boolean,
        default: !1
    },
    bgColor: {
        type: String,
        default: "#fff"
    },
    fontColor: {
        type: String,
        default: "rgba(53, 53, 53, 1.0)"
    },
    styleType: {
        type: String,
        default: "style1"
    }
      },
      data:{
        init: !1,
        cate: [],
        topRefresh: 0,
        bottomRefresh: 0,
        item: {
            class_ids: 0,
            data_type: "auto",
            id: "find-list-auto",
            num: 10,
            order: "create_time",
            showtitle: !0,
            sort: "desc",
            css: {
                "find-list-auto": "background-color:rgba(255, 255, 255, 1.0);background:rgba(255, 255, 255, 1.0);",
                "find-list-auto &a_desc": "font-family:undefined;font-size:12.00px;color:rgba(155, 155, 155, 1.0);font-weight:400;font-style:normal;text-decoration:unset;text-align:undefined;",
                "find-list-auto &a_time": "font-family:undefined;font-size:9.00px;color:rgba(175, 177, 175, 1.0);font-weight:400;font-style:normal;text-decoration:unset;text-align:undefined;",
                "find-list-auto &a_title": "font-family:undefined;font-size:14.00px;color:rgba(53, 53, 53, 1.0);font-weight:400;font-style:normal;text-decoration:unset;text-align:undefined;",
                "find-list-auto &item_image": "border-top:1px solid rgba(241, 241, 241, 1.0);border-right:1px solid rgba(241, 241, 241, 1.0);border-bottom:1px solid rgba(241, 241, 241, 1.0);border-left:1px solid rgba(241, 241, 241, 1.0);border-radius:4px 4px 4px 4px;"
            },
            animation: {},
            list: []
        },
        activeIndex: 0,
        activeSecondIndex: 0,
        page_path: "pages/find/index",
        showH5: !1,
        init:true,
      },
    lifetimes: {
        attached: function () {
          var that=this
          that.setData({
            globalColor:app.globalData.globalColor
          })
          wx.request({
              url: app.globalData.siteroot,
              data: { 
                do:'Article_ArticleClass',
                class_id:''
              },
              success: function(res) {
                   that.setData({
                       cate:res.data.info
                   })
                   that.alist(res.data.info[0].id)
              }
            })
       }
      },
    methods: {
      changecate:function(e){
          this.setData({
            activeIndex:e.currentTarget.dataset.index
          })
          this.alist(this.data.cate[e.currentTarget.dataset.index].id)
      },
      alist:function(ids){
        var that=this
        wx.request({
            url: app.globalData.siteroot,
            data: { 
              do:'List_Data',
              type:'article',
              num: that.data.item.num,
              class_ids: ids,
              sort:that.data.item.sort,
              order:that.data.item.order,
              ids:'',
              data_type:that.data.item.data_type,
              page: 1,
              user_id: wx.getStorageSync('user_id'),
            },
            success: function(res) {
                  that.setData({
                    bottomRefresh:res.data.info
                  })
                  console.log(res.data.info)
            }
          })
      }
    }
});
